package cn.shengongying.model;

import cn.shengongying.bean.BaseModal;
import cn.shengongying.bean.BaseUser;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * <p>
 * 用户/雇主表
 * </p>
 *
 * @author RXK
 * @since 2022-01-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class Customer extends BaseModal {

    private static final long serialVersionUID = 1L;

    private String account;

    /**
     * 密码
     */
    private String password;

    /**
     * 昵称
     */
    private String nickName;

    /**
     * 签名
     */
    private String signature;

    /**
     * 头像
     */
    private String img;

    /**
     * 性别(0:男;1:女)
     */
    private Integer sex;

    /**
     * 手机号
     */
    private String phone;

    /**
     * 生日
     */
    private Date birthday;

    /**
     * 收货地址
     */
    private String address;

    /**
     * 状态(0:启用;1:关闭)
     */
    private Integer status;

    private String weiXin;

    private String qq;

    /**
     * 类型(0:普通用户;1:雇主)
     */
    private Integer type;

    /**
     * 类别(0:加工商;1:模具商;2:设备商)
     */
    private Integer category;

    /**
     * 成立时间
     */
    private Date establishedTime;

    private Date disableDay;


    public static Customer build(String phone) {
        Customer customer = new Customer();
        customer.setAccount(phone);
        customer.setPhone(phone);
        customer.setNickName("v_" + phone);
        customer.setType(1);
        customer.setStatus(0);
        return customer;
    }

    public BaseUser buildBaseUser() {
        BaseUser baseUser = new BaseUser();
        baseUser.setId(this.getId());
        baseUser.setTelephone(this.phone);
        return baseUser;
    }
}
